﻿using System;

namespace XTengine.ComponentModel
{
    public class UInt16Converter : TypeConverter<UInt16>
    {
        public override UInt16 ConvertFrom(string value)
        {
            UInt16 result;
            if (UInt16.TryParse(value, out result))
            {
                return result;
            }

            return 0;
        }

        public override string ConvertTo(UInt16 value)
        {
            return value.ToString();
        }
    }
}